import numpy as np


def G2L(origin,dir_h,dir_v,globs):
    locs=[]
    for i in range(len(globs)):
        re_v = globs[i]-origin
        h_coefficient = float(np.inner(re_v,dir_h))
        v_coefficient = float(np.inner(re_v,dir_v))
        loc = [h_coefficient,v_coefficient]
        locs.append(loc)

    return locs

# o= np.array([1674.91000000005, 724.912, -653.627])
#
# dir_h = np.array([ 0.,  0., -1.])
# dir_v = np.array([-1.,  0.,  0.])
#
# globs = np.array([[1674.91 ,  734.912, -663.627],
#        [1579.91 ,  734.912, -663.627],
#        [1579.91 ,  734.912, -693.627],
#        [1559.91 ,  734.912, -693.627],
#        [1559.91 ,  734.912, -643.627],
#        [1674.91 ,  734.912, -643.627]])
#
#
# print(G2L(o,dir_h,dir_v,globs))